package com.example.orderform.dao;

import com.example.orderform.vo.Order;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface PaymentMapper {

    @Select("select count(*) from order_copy1 where orderstatus='等待买家付款' and userid=#{userid}"
    )
    int paycha(int userid);

    @Select("select * from order_copy1 where orderstatus='等待买家付款' and userid=${userid} LIMIT #{q},#{j}")
    List<Order>fenyecha(int q,int j,int userid);

    @Select("select * from order_copy1 where orderid=${orderid}")
    Order payorderxq(int orderid);

    @Update("update order_copy1 set orderstatus='交易关闭' , cancel='${cancel}',statusbutton='交易关闭',statusbuttonunder='交易关闭' where orderid='${orderid}' ")
    int qx(String orderid,String cancel);


    @Select("select * from order_copy1 where orderid=${orderid}")
    String djs(int orderid);


    @Update("update order_copy1 set orderstatus='交易关闭',statusbutton='交易关闭',statusbuttonunder='交易关闭' where orderid=${orderid}")
    int gb(int orderid);


    @Select("SELECT comitydescription FROM `order_copy1` where orderid=#{orderid}")
    String comitydescription(int orderid);

    @Update("update order_copy1 set payway='支付宝',paytime=NOW(),orderstatus='买家已付款',statusbutton='退货退款',statusbuttonunder=null where orderid=#{orderid}")
    int updatedd(int orderid);


}
